Skip to content

[6.0] Extend versioning, save releated information in history table and restore historical data#45515

Merged
softforge merged 36 commits intojoomla:6.0-devfrom
rdeutz:versions
Aug 17, 2025
Merged

[6.0] Extend versioning, save releated information in history table and restore historical data#45515
softforge merged 36 commits intojoomla:6.0-devfrom
rdeutz:versions

Conversation

@rdeutz
Copy link
Contributor

@rdeutz rdeutz commented May 22, 2025

Our versioning works on databse table level, this leads to situations that we save an article with custom fields but the CF are not included in the history. This is unexpected from a user perspective. This PR starts to change this behaviour so that releated information are also saved.

Summary of Changes

I have added an interface VersionableModelInterface, if a model implements this interface then in AdminModel the save of the histroy data is done in the save method (calls saveHistory) of the Model. This is the first step and we have now the data with releated information in the history table.

If you want to restore a version then in loadHistory (VersionableModelTrait) set the data from the history table as session data and loadForm use this data when you edit an item.

It works for CF so far. At the moment not for Tags (tags is a pain, we might change more on tags for 6 so I haven't looked into the details why not).

This is a b/c break and I don't know how many are affected but I think that it can't be too much hassle and what we get when we finish this is worth the work for extensions developers.

  • Look into tags
  • Extend to other core items where we are using versions (Banner, Banner Client, newfeeds, Categories Tags).
  • Remove behaviour plugin
  • Fix tests

Testing Instructions

It is now done for all core extensions and item whitch supports versions

  • Create some custom fields
  • Create an article and save some versions of it
  • Restore versions back and force

Actual result BEFORE applying this Pull Request

Custom fields have always the last saved value

Expected result AFTER applying this Pull Request

Custom fields have the value from the saved version, Tags get restored

Link to documentations

Documentation will be provided at a later stage.

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

@rdeutz rdeutz added the b/c break This item changes the behavior in an incompatible why. HEADS UP label May 22, 2025
@rdeutz rdeutz added the Feature label May 28, 2025
@peterpeter
Copy link
Contributor

I have tested this item ✅ successfully on eb8533b

Successful tested with a text-, integer-, list- and checkboxfield(s).

B.t.w.
Comparing versions is throwing an error:
https://prnt.sc/bvWwN0TaKwSq
with or without this patch


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45515.

1 similar comment
@peterpeter
Copy link
Contributor

I have tested this item ✅ successfully on eb8533b

Successful tested with a text-, integer-, list- and checkboxfield(s).

B.t.w.
Comparing versions is throwing an error:
https://prnt.sc/bvWwN0TaKwSq
with or without this patch


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45515.

@richard67 richard67 changed the title [6.0] RFC extend versioning, save releated information in history table and restore historcal data [6.0] RFC extend versioning, save releated information in history table and restore historical data Jun 3, 2025
@rdeutz
Copy link
Contributor Author

rdeutz commented Aug 4, 2025

I now know why the tests are failing, when creating a banner over the api only the table class is used and not the model. So the problem is "only" an API problem.

@softforge
Copy link
Contributor

I also got the An error has occurred. 0 htmlspecialchars(): Argument #1 ($string) must be of type string, array given error when comparing with or without, but the PR certainly restores the custom fields and tags restored, really nice feature

@exlemor
Copy link

exlemor commented Aug 9, 2025

@rdeutz - there are some issues with this PR ;(

Sometimes it restores with a blank article, sometimes not, (no error message), Tags not restored :/

(sorry)

@richard67
Copy link
Member

I now know why the tests are failing, when creating a banner over the api only the table class is used and not the model. So the problem is "only" an API problem.

@rdeutz Then the failing API test should be commented out with a to do comment so that system tests are passing. Merging this PR as it is would mean to break system tests in the 6.0-dev branch.

@muhme
Copy link
Contributor

muhme commented Aug 12, 2025

I now know why the tests are failing, when creating a banner over the api only the table class is used and not the model. So the problem is "only" an API problem.

Maybe @heelc29 or @alikon could help with the API so that the system test works again?

@exlemor
Copy link

exlemor commented Aug 16, 2025

I have tested this item ✅ successfully on c027b4d

I have re-tested this successfully. Thanks @rdeutz! Keep up the great work!


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45515.

@brianteeman
Copy link
Contributor

When you restore to the initial version the buttons disappear AND you cannot save the article

See video

chrome_0NbUOiTwTM.mp4

@brianteeman
Copy link
Contributor

I have tested this item 🔴 unsuccessfully on c027b4d


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45515.

richard67 and others added 2 commits August 17, 2025 12:04
Co-authored-by: Martina  Scholz <64533137+LadySolveig@users.noreply.github.com>
@softforge softforge added this to the Joomla! 6.0.0 milestone Aug 17, 2025
@softforge softforge merged commit adb79e9 into joomla:6.0-dev Aug 17, 2025
30 checks passed
@softforge
Copy link
Contributor

Thank you to @rdeutz for his work on this and to @LadySolveig and @richard67 for the work they did fixing this to the point we could merge. Thank you to all the testers and also for the work done by @brianteeman to make sure deficiencies were noted and documented so we have a clear measure of what must be done to get this ready before RC

@heelc29
Copy link
Contributor

heelc29 commented Aug 17, 2025

I have tested this item 🔴 unsuccessfully on c027b4d


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45515.

@heelc29
Copy link
Contributor

heelc29 commented Aug 17, 2025

Still issues

Create new article and save two times (2 versions are stored) - before only 1 version
image

Star to mark current version is no longer working
image

Restore options (e.g. show/hide title) from older history not working
image

@richard67
Copy link
Member

@heelc29 Could you open a new issue with your findings? Maybe @brianteeman could then add his findings, too.

@rdeutz
Copy link
Contributor Author

rdeutz commented Aug 17, 2025

Thank you all for testing and pointing out the issues. I know there are still issues and I will do my best to fix them asap.

@ceford
Copy link
Contributor

ceford commented Sep 3, 2025

At the bottom of the Preview of Version form there is a com_fields label that looks like an untranslated string, along with two others above and one below. Is that a bug? And the current version is not marked! The Help screen says it is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

b/c break This item changes the behavior in an incompatible why. HEADS UP Feature Language Change This is for Translators PR-6.0-dev

Projects

None yet

Development

Successfully merging this pull request may close these issues.